#pragma once

#include "List.h"
#include "FSMCartridge.h"

enum FSM_CODE
{
	SYS_SUCCESS,
	SYS_CART_EMPTY,
};

class FSMSystem
{
public:
	//attributes
	bool m_powered;
	bool m_next;
	bool m_prev;

	int m_powerOffId;
	FSMCartridge* m_current;
	List<FSMCartridge*> m_fsmList;

	//ctor
	FSMSystem()
		: m_powered(false),
		m_next(false),
		m_prev(false),
		m_powerOffId(-1),
		m_current(0){}

	//cartidge looper
	virtual void init();
	virtual void release();
	virtual void input();
	virtual void update();
	virtual void draw();
	virtual void preLoop();
	virtual void postLoop();
	
	//system commands
	int powerOnSystem();
	int powerOffSystem();
	int checkCartridge();
	int swapCartridge();

	void nextCartridge();
	void prevCartridge();
	void queueCartridge(FSMCartridge* a_cartridge);
	void powerOffId(int a_id){m_powerOffId = a_id;}
	
	bool isPowered(){return m_powered;}
	bool inNextTransition(){return m_next;}
	bool inPrevTransition(){return m_prev;}
	
	char* getCartridgeName(){return m_current->m_name;}
};